package com.demo;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.Properties;

@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class mainTest {
    @Test
    public void testSystem() {
        //获取系统属性
        Properties properties = System.getProperties();
        //操作系统名称
        log.info("{}", properties.getProperty("os.name"));
        //操作系统版本
        log.info("{}", properties.getProperty("os.version"));
        //操作系统架构
        log.info("{}", properties.getProperty("os.arch"));
        //用户的账户名称
        log.info("{}", properties.getProperty("user.name"));
        //用户的主目录
        log.info("{}", properties.getProperty("user.home"));
        //用户的当前工作目录
        log.info("{}", properties.getProperty("user.dir"));
        //Java 运行时环境版本
        log.info("{}", properties.getProperty("java.version"));
    }
}
